{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "enter the number 30\n",
      "b {'truck': 0, 'bike': 0, 'car': 0, 'wheel': 30, 'seat': 30}\n",
      "2 1\n",
      "b {'truck': 0, 'bike': 1, 'car': 0, 'wheel': 28, 'seat': 29}\n",
      "2 1\n",
      "b {'truck': 0, 'bike': 2, 'car': 0, 'wheel': 26, 'seat': 28}\n",
      "2 1\n",
      "b {'truck': 0, 'bike': 3, 'car': 0, 'wheel': 24, 'seat': 27}\n",
      "2 1\n",
      "b {'truck': 0, 'bike': 4, 'car': 0, 'wheel': 22, 'seat': 26}\n",
      "2 1\n",
      "b {'truck': 0, 'bike': 5, 'car': 0, 'wheel': 20, 'seat': 25}\n",
      "2 1\n",
      "b {'truck': 0, 'bike': 6, 'car': 0, 'wheel': 18, 'seat': 24}\n",
      "2 1\n",
      "b {'truck': 0, 'bike': 7, 'car': 0, 'wheel': 16, 'seat': 23}\n",
      "2 1\n",
      "b {'truck': 0, 'bike': 8, 'car': 0, 'wheel': 14, 'seat': 22}\n",
      "2 1\n",
      "b {'truck': 0, 'bike': 9, 'car': 0, 'wheel': 12, 'seat': 21}\n",
      "2 1\n",
      "b {'truck': 0, 'bike': 10, 'car': 0, 'wheel': 10, 'seat': 20}\n",
      "2 1\n",
      "b {'truck': 0, 'bike': 11, 'car': 0, 'wheel': 8, 'seat': 19}\n",
      "2 1\n",
      "b {'truck': 0, 'bike': 12, 'car': 0, 'wheel': 6, 'seat': 18}\n",
      "2 1\n",
      "b {'truck': 0, 'bike': 13, 'car': 0, 'wheel': 4, 'seat': 17}\n",
      "2 1\n",
      "b {'truck': 0, 'bike': 14, 'car': 0, 'wheel': 2, 'seat': 16}\n",
      "2 1\n",
      "dict_values([0, 15, 0, 0, 15])\n"
     ]
    }
   ],
   "source": [
    "n=int(input(\"enter the number \"))\n",
    "class vehicle:\n",
    "    def __init__(self, wheel, seat):\n",
    "        self.wheel =wheel\n",
    "        self.seat =seat\n",
    "class truck(vehicle): \n",
    "    def __init__(self,wheel=6,seat=2): #default values are given as 6 and 2\n",
    "        self.wheel=wheel\n",
    "        self.seat=seat\n",
    "class car(vehicle): \n",
    "    def __init__(self,wheel=4,seat=5): #default values are given as 4 and 5\n",
    "        self.wheel=wheel\n",
    "        self.seat=seat   \n",
    "class bike(vehicle): \n",
    "    def __init__(self,wheel=2,seat=1): #default vaues are given as 2 and 1\n",
    "        self.wheel=wheel\n",
    "        self.seat=wheel \n",
    "        \n",
    "#-----------------------------------------------------------------------------------------------        \n",
    " \n",
    "def createtruck(d):\n",
    "    tr=truck()\n",
    "    d['truck']=d['truck']+1\n",
    "    d['wheel']=d['wheel']-tr.wheel\n",
    "    d['seat']=d['seat']-tr.seat\n",
    "    if d['wheel']<0 or d['seat']<0:\n",
    "        return 1\n",
    "    else:\n",
    "        return d\n",
    "def createcar(d):\n",
    "    cr=car()\n",
    "    d['car']=d['car']+1\n",
    "    d['wheel']=d['wheel']-cr.wheel\n",
    "    d['seat']=d['seat']-cr.seat\n",
    "    if d['wheel']<0 or d['seat']<0:\n",
    "        return 1\n",
    "    else:\n",
    "        return d\n",
    "def createbike(d):\n",
    "    bk=bike()\n",
    "    print(bk.wheel, bk.seat)\n",
    "    d['bike']=d['bike']+1\n",
    "    d['wheel']=d['wheel']-bk.wheel\n",
    "    d['seat']=d['seat']-bk.seat\n",
    "    if d['wheel']<0 or d['seat']<0:\n",
    "        return 1\n",
    "    else:\n",
    "        return d\n",
    "#------------------------------------------------------------------------------------------------    \n",
    "        \n",
    "        \n",
    "        \n",
    "        \n",
    "\n",
    "d={'truck':0,'bike':0,'car':0,'wheel':n,'seat':n}\n",
    "while d['wheel']>0 and d['seat']>0:\n",
    "    trwh=d['wheel']//6  #gives floor value of total wheels that are required\n",
    "    trs=d['seat']//2    #gives floor value of total seats that are required\n",
    "    tottruck=min(trwh,trs) #total number of trucks that can be created \n",
    "   \n",
    "\n",
    "    crwh=d['wheel']//4\n",
    "    crs=d['seat']//5\n",
    "    totcar=min(crwh,crs) #total number of cars that can be created\n",
    "    \n",
    "\n",
    "    bkwh=d['wheel']//2\n",
    "    bks=d['seat']//1\n",
    "    totbikes=min(bkwh,bks) #total number of bikes that can be created\n",
    "    \n",
    "    \n",
    "\n",
    "    \n",
    "    m=0\n",
    "    d1={'maketruck':tottruck,'makebike':totbikes,',makecar':totcar}\n",
    "    for key,val in d1.items():\n",
    "        if val>m:\n",
    "            m=val\n",
    "            maxim=key\n",
    "    \n",
    "           \n",
    "        \n",
    "    if maxim=='maketruck':\n",
    "        print(\"t\",d)\n",
    "        createtruck(d)\n",
    "        \n",
    "    elif maxim=='makebike':\n",
    "        print(\"b\",d)\n",
    "        createbike(d)\n",
    "        \n",
    "    elif maxim=='makecar':\n",
    "        print(\"c\")\n",
    "        createcar(d)\n",
    "      \n",
    "    \n",
    "\n",
    "\n",
    "print(d.values())    \n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "15"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "30//2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
